using System;
using System.Collections.Generic;
using System.Text;

using SchEdu.Framework.DataModel;
using SchEdu.Framework.Exceptions;

namespace SchEdu.Framework.Validators
{
    /// <summary>
    /// Validate Processing Time are non negative
    /// </summary>
    public class OperationProcessingTimeValidator : Validator
    {
        public OperationProcessingTimeValidator(SchEduData schEduData)
            : base(schEduData)
        {
        }

        #region IValidator Members

        public override void Validate()
        {
            foreach (SchEduDataSet.OperationRow operation in SchEduData.Operation)
            {
                if (operation.ProcessingTime <= 0)
                {
                    throw new ValidatorException(string.Format(Resources.OperationDoesNotHaveProcessingTime, operation.OrderRow.OrderNo, operation.OperationNo));
                }
            }
        }

        #endregion
    }
}
